<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const p1 = () => {
            return new Promise((resolve,reject) =>{
                setTimeout(()=>{
                    console.log('p1');
                    resolve(1)
                },1000)
            })
        }
        const p2 = () => {
            return new Promise((resolve,reject) =>{
                setTimeout(()=>{
                    console.log('p2');
                    resolve(2)
                },500)
            })
        }
        const p3 = () => {
            return new Promise((resolve,reject) =>{
                setTimeout(()=>{
                    console.log('p3');
                    resolve(3)
                },1500)
            })
        }
        p1()
        .then(()=>{
            return p2()
        })
        .then(()=>{
            return p3()
        })
        .then(()=>{
            console.log('最后触发了');
        })
        .catch(()=>{
            console.log(err);
        })
        </script>
</body>
</html>